import { IPolyline, Polyline } from './polyline'

interface IPolygon extends IPolyline {}

export class Polygon extends Polyline {
  constructor(props: IPolygon) {
    super(props)
    this.type = 'polygon'
  }
  public drawPath(ctx: CanvasRenderingContext2D): void {
    ctx.fill(this.path)
  }
  public clone() {
    return new Polygon({
      ...this.option,
      ...this.getBaseCloneAttr(),
      points: JSON.parse(JSON.stringify(this._points)),
      smooth: this._smooth,
      close: this._close
    })
  }
}
